<div class="students index">
<h2><?php __('Students');?></h2>
<!-- Table Navigation -->
<div class="tablenav">
    <div class="batchactions"></div>
    <?php echo $this->element('pager'); ?>
</div>
<!-- Table Content Area -->
<table id="table_students" class="table fixed">
    <thead title="<?php __('Click a column to sort data table'); ?>">
        <tr>
            <th width="3%" class="checkbox" title="<?php __('Click to select/deselect all records'); ?>"><input type="checkbox" class="checkbox"/></th>
            <th width="25%" class="name"><?php __('Basic Information');?></th>
            <th width="10%" class="number"><?php echo $paginator->sort('number');?></th>
            <th width="10%" class="class"><?php echo $paginator->sort('class');?></th>
            <th width="8%" class="minority"><?php echo $paginator->sort('student_minority_id');?></th>
            <th width="8%" class="province"><?php echo $paginator->sort('student_province_id');?></th>
            <th width="10%" class="political"><?php echo $paginator->sort('political');?></th>
            <th width="26%" class="extra"><?php __('Extra Information');?></th>
        </tr>
    </thead>
    <tfoot title="<?php __('Click a column to sort data table'); ?>">
        <tr>
            <th class="checkbox" title="<?php __('Click to select/deselect all records'); ?>"><input type="checkbox" class="checkbox"/></th>
            <th class="name"><?php __('Basic Information');?></th>
            <th class="number"><?php echo $paginator->sort('number');?></th>
            <th class="class"><?php echo $paginator->sort('class');?></th>
            <th class="minority"><?php echo $paginator->sort('student_minority_id');?></th>
            <th class="province"><?php echo $paginator->sort('student_province_id');?></th>
            <th class="political"><?php echo $paginator->sort('political');?></th>
            <th class="extra"><?php __('Extra Information');?></th>
        </tr>
    </tfoot>
    <tbody>
        <?php foreach ($students as $i=>$student):
            $class = $i % 2 == 0 ? ' class="altrow"' : ''; ?>
        <tr<?php echo $class;?>>
            <td class="checkbox"><input type="checkbox" class="checkbox"/></td>
            <!-- Student.modified, name, gender, bitrhday, email, ACTIONS -->
            <td class="name">
                <!-- Student.Modified -->
                <!--p class="modified">
                    <?php __('Last Modified'); ?>&nbsp;
                    <?php echo $html->link($time->format($options['dateFormat'], $student['Student']['modified']),
                        array('modified' => $time->format($options['queryDateFormat'], $student['Student']['modified'])),
                        array('title' => sprintf(__('View students modified on %s', true), $time->format($options['queryDateFormat'], $student['Student']['created'])))
                    ); ?>
                </p-->
                <!-- Student.name; gender, birth -->
                <p class="name">
                    <?php e($html->link($student['Student']['name'],
                        array('action' =>'view', $student['Student']['id'])
                    )); ?>
                    (<?php e($html->link($student['Student']['gender'],
                        array('gender' =>$student['Student']['gender']),
                        array('title' =>sprintf(__('View all %s', true), $student['Student']['gender']))
                    )); ?>, &nbsp;<?php echo $student['Student']['birthday']; ?>)
                </p>
                <!-- Student.email -->
                <p class="email">
                    <?php echo $text->autoLinkEmails($student['Student']['email'],
                        array('title'=>sprintf(__('Send mail to: %s', true), $student['Student']['name']))); ?>
                </p>
                <?php if($user['group'] != 'student'): ?>
                    <p class="actions">
                        <span class="view">
                            <?php echo $html->link(__('View', true),
                                array('action'=>'view', $student['Student']['id'])); ?>
                        </span>
                        <!--span class="edit">
                            <?php echo $html->link(__('Edit', true),
                                array('action'=>'edit', $student['Student']['id'])); ?>
                        </span-->
                        <span class="delete">
                            <?php echo $html->link(__('Delete', true),
                                array('action'=>'delete', $student['Student']['id'])); ?>
                        </span>
                    </p>
                <?php endif; ?>
            </td>
            <!-- Student.number -->
            <td class="number">
                <p class="number">
                    <?php $enrolled = substr($student['Student']['number'], 0, 4); ?>
                    <?php e($html->link($student['Student']['number'],
                        array('number' =>$enrolled),
                        array('title' =>sprintf(__('View all students enrolled in %s', true), $enrolled))
                    )); ?>
                </p>
            </td>
            <!-- Student.class -->
            <td class="class">
                <p class="class">
                    <?php e($html->link($student['Student']['class'],
                        array('class' =>$student['Student']['class']),
                        array('title' =>sprintf(__('View all students in class %s', true), $student['Student']['class']))
                    )); ?>
                </p>
            </td>
            <!-- Student.minority -->
            <td class="minority">
                <p class="minority">
                    <?php e($html->link($student['StudentMinority']['name'],
                        array('student_minority_id' =>$student['StudentMinority']['id']),
                        array('title' =>sprintf(__('View all %s students', true), $student['StudentMinority']['name']))
                    )); ?>
                </p>
            </td>
            <!-- Student.Province -->
            <td class="province">
                <p class="province">
                    <?php e($html->link($student['StudentProvince']['name'],
                        array('student_province_id' =>$student['StudentProvince']['id']),
                        array('title' =>sprintf(__('View all students from %s', true), $student['StudentProvince']['name']))
                    )); ?>
                </p>
            </td>
            <!-- Student.political -->
            <td class="political">
                <p class="political">
                    <?php e($html->link($student['Student']['political'],
                        array('political' =>$student['Student']['political']),
                        array('title' =>sprintf(__('View all %s', true), $student['Student']['political']))
                    )); ?>
                </p>
            </td>
            <!-- Student.phone, resume, created -->
            <td class="extra">
                <p class="phone">
                    <?php __('Mobile'); ?>:
                    <?php echo $student['Student']['phone']; ?>
                </p>
                <p class="resume">
                    <?php if($student['Student']['resume']): ?>
                        <?php __('resume status: yes'); ?>
                    <?php else: ?>
                        <?php __('resume status: no'); ?>
                    <?php endif; ?>
                </p>
            </td>
        </tr>
        <?php endforeach; ?>
    <tbody>
</table>
</div>
<?php //debug($students); ?>

<script type="text/javascript">
jQuery(function(){
    // Apply for the job through ajax
    $('table#table_students p.actions a[href*=delete]').click($.sme.cbk.ajaxDelete);
    /* Show hide action links */
    $('tbody tr').hover($.sme.cbk.showActions, $.sme.cbk.hideActions);
});
</script>